// This is a JavaScript file

$(document).ready(function() {
	// init mapservice object
	var objMapService = new MapService();
	// -- 各地方を呼び出す --- call mapster plugin
	// var arrLocationMap = "#image-maps-2014-05-01-194232";
	// objMapService.callImageMapster(arrLocationMap);
	var msg = new Message();
	var xref = {
		Register : msg.data.REGISTER,
		Yoyaku_List : msg.data.BOOKING,
		History_List : msg.data.HISTORY,
		main : msg.data.MAIN,
		Passwd_Change : msg.data.CHANGE_PASSWD,
	}
	var html = $("<div></div>").attr({
		"class" : "map_tooltip",
	}).text("Dont mess with VN");
	var mapKey = "#image_map_0001";
	var options = {
		fill : true,
		stroke : false,
		mapKey : 'data-key',
		showToolTip : true,
		toolTipClose : 'area-mouseout',
		scaleMap : true,
		// fillColor : 'f89406',
		singleSelect : true,
		// onShowToolTip : showToolTipHandler,
		onClick : clickHandler,
		areas : [ {
			key : "Yoyaku_List",
			toolTip : xref['Yoyaku_List']
		}, {
			key : "History_List",
			toolTip : xref['History_List']
		}, {
			key : "Register",
			toolTip : xref['Register']
		}, {
			key : "Passwd_Change",
			toolTip : xref['Passwd_Change']
		}, {
			key : "main",
			toolTip : xref['main']
		} ],
		render_highlight : {
			fillOpacity : 0
		},
		render_select : {
			fillOpacity : 0
		}
	};
	$(mapKey).mapster(options);

	/**
	 * handler show tooltip
	 * 
	 */
	function showToolTipHandler(e) {
		// custom tooltip
		$(mapKey).mapster('set_options', {
			areas : [ {
				key : "Yoyaku_List",
			}, {
				key : "History_List",
			}, {
				key : "Register",
			}, {
				key : "Passwd_Change",
			}, {
				key : "main",
			} ]
		});
	}
	function clickHandler(e) {
		// handle when click to circle

		if (e.key == 'Register') {
			javascript: location.href = 'search.htm';
		}
		if (e.key == 'History_List') {
			javascript: location.href = 'history.htm';
		}
		if (e.key == 'Yoyaku_List') {
			javascript: location.href = 'yoyakulist.htm';
		}
		if (e.key == 'Passwd_Change') {
			javascript: location.href = 'changepasswd.htm';
		}
		if (e.key == 'main') {
			// show overview
		}
	}

});